<?php
require_once PATH_SITE.'cn/royan/php/utils/Plugins.util.php';
require_once PATH_SITE.'cn/royan/php/parses/ValidLoginParse.parse.php';
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of UserLogoutParse
 *
 * @author yanr
 */
class UserLogoutParse extends ValidLoginParse
{
    //put your code here
    const TYPE = "UserLogout";
    public function __construct($typeName = NULL) {
        parent::__construct( UserLogoutParse::TYPE );
        Logger::trace( "UserLogoutParse Open" );
    }
    
    public function parseInfo($info) {
        IF( parent::parseInfo($info) === FALSE ) RETURN FALSE;
        
        $feedback = TRUE;
        $pluginClass = Plugins::findPlugin( UserLogoutParse::TYPE );

        IF ( $pluginClass !== FALSE )
        {
            $feedback = FALSE;
            $plugin = new $pluginClass( $info["user"] );
            $feedback = $plugin->excute();
        }
        
        IF( $feedback )
        {
            IF( !is_null( $info["user"]->__get("room") ) )
            {
                $data = array( "user"=> $info["user"],
                               "area"=> $area,
                               "room"=> $area->__get("default"),
                               "type"=> UserLeaveRoomParse::TYPE );

                $connectProxy = ConnectParse::getInstance();
                $connectProxy->parseInfo( $data );
            }
        }
    }
}

?>
